package com.cloud.prac.controller;

import com.cloud.prac.aop.annotation.RepeatSubmit;
import com.cloud.prac.model.StudentInfo;
import com.cloud.prac.service.test.TestService;
import com.prac.common.result.DataResult;
import com.prac.common.result.ListResult;
import com.prac.common.result.Page;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * TestController
 *
 * @author 24373
 * @version 1.0
 * @date 2024-06-05 23:00
 */
@RestController
@RequestMapping("/test")
public class TestController {
    @Resource
    private TestService testService;

    @RepeatSubmit(message = "测试防重复提交")
    @RequestMapping("t")
    public DataResult<String> test() {
        return new DataResult<>(testService.test());
    }

    @RequestMapping("list")
    public ListResult<StudentInfo> testList() {
        return new ListResult<>(testService.testList());
    }

    @RequestMapping("page")
    public ListResult<StudentInfo> testPage() {
        return new ListResult<>(testService.testPage(new Page(2, 5)));
    }

}
